import {
    ChangeDetectorRef,
    Component,
    EventEmitter,
    Input,
    OnChanges,
    OnInit,
    Output,
    SimpleChanges
} from '@angular/core';

@Component({
    selector: 'app-normal-select',
    templateUrl: './index.component.html',
    styleUrls: ['./index.component.scss']
})
export class NormalSelectComponent implements OnInit ,OnChanges{
    @Input()
    selectKey: string="";
    @Output()
    selectKeyChange: EventEmitter<string> = new EventEmitter();
    @Input()
    value: any[]
    @Input()
    dictPlaceholder: string = '字典';
    @Input()
    model:string = 'default';
    @Input()
    allowClear:boolean = true;
    constructor(private _changeDetectorRef: ChangeDetectorRef) {}

    ngOnInit() {
    }

    ngOnChanges(changes: SimpleChanges): void {
    }


    onSelectionChange() {
        if(this.selectKey===null){
            this.selectKeyChange.emit("");
        }else {
            this.selectKeyChange.emit(this.selectKey);
        }
    }
}
